package com.itlong.cloud.enumerate;

/**
 * <desc>
 *      物业巡检类型枚举
 * </desc>
 *
 * @createDate 2019-12-24
 */
public enum PropertyInspectTypeEnum {

    INSPECT_AREA("巡检区域", 1),
    INSPECT_POINT("巡检点",2),
    INSPECT_LINE("巡检路线",3),
    INSPECT_PLAN("巡检计划",4),
    ;
    private String description;
    private Integer type;

    /**
     * <desc>
     *      物业巡检类型枚举无参构造函数
     * </desc>
     * @param
     * @return
     * @author Biao.R
     * @createDate 2017/10/13
     */
    PropertyInspectTypeEnum() {
    }

    /**
     * <desc>
     *      物业巡检类型枚举描述与类型构造函数
     * </desc>
     * @param description 描述
     * @param type 类型
     * @return
     * @author Biao.R
     * @createDate 2017/10/13
     */
    PropertyInspectTypeEnum(String description, Integer type) {
        this.type = type;
        this.description = description;
    }

    /**
     * <desc>
     *      获取巡检类型枚举描述
     * </desc>
     * @param
     * @return String
     * @author Biao.R
     * @createDate 2017/10/13
     */
    public String getDescription() {
        return description;
    }

    /**
     * <desc>
     *      获取巡检类型枚举类型
     * </desc>
     * @param
     * @return Integer
     * @author Biao.R
     * @createDate 2017/10/13
     */
    public Integer getType() {
        return type;
    }

    /**
     * <desc>
     *      获取枚举的描述
     * </desc>
     * @param type 枚举类型
     * @return 枚举描述
     * @author Biao.R
     * @createDate 2017/10/13
     */
    public static String getDescription(Integer type){
        if (type == null) {
            return null;
        }
        PropertyInspectTypeEnum[] types = PropertyInspectTypeEnum.values();
        for(PropertyInspectTypeEnum limitCategory : types ){
            if(limitCategory.getType() == type){
                return limitCategory.getDescription();
            }
        }
        return "";
    }

    /**
     * <desc>
     *      根据设备类型获取设备类型的枚举
     * </desc>
     * @param equipType 枚举类型
     * @return 枚举描述
     * @author Biao.R
     * @createDate 2017/10/13
     */
    public static PropertyInspectTypeEnum getByEquipType(Integer equipType){
        if (equipType != null) {
            for (PropertyInspectTypeEnum value : values()) {
                if (value.getType() == equipType) {
                    return value;
                }
            }
        }
        return null;
    }
}
